import { IncomingHttpHeaders } from 'http';

import query from '@dfeidao/atom-nodejs/db/query';
import { productid, systemid } from '../../atom/config';
interface Message {
	filter: {
		data_v: string
	};
	// cookie: {
	// 	uk: string;
	// 	[key: string]: string
	// };
	// urls: {
	// 	base: string;
	// 	origin: string;
	// 	url: string;
	// };
	// query: {};
	// params: {};
	// headers: {};
	// captcha: string;
}

// interface IWebResult {
// 	data: unknown;
// 	cookie?: {
// 		[name: string]: string;
// 	} | null;
// 	content_type?: string;
// 	headers?: {
// 		[key: string]: string;
// 	};
// 	attachment?: string;
// 	redirect?: string;
// 	status_code?: number;
// }
/** 工单排序 */
export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders) {

	const q = query(action_id, session_id, systemid);
	q.prepare('work_order', ['work_bill_no', 'project_name', 'responsible', 'job_content', 'completion_time'],
		{ productid, work_order_status: 1 }, 20, 1, ['' + message.filter.data_v + ''], []);
		q.prepare('work_order', ['work_bill_no', 'project_name', 'responsible', 'job_content', 'completion_time'],
		{ productid, work_order_status: 1 }, 20, 1, [], ['' + message.filter.data_v + '']);
	const [d1,d2] = await q.exec();
	return {d1,d2};
}
